﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using DataAnnotationsExtensions;

namespace KpBusiness.Model
{
    public class UserInformation
    {

        [Key]
        public virtual int UserId { get; set; }
     
        [Required(ErrorMessage = "Please Provide Username")]
        public virtual string UserName { get; set; }
       
        
        [Required(ErrorMessage="Please Provide Password")] 
        public virtual string Password { get; set; }

        public virtual string ConfirmPassword { get; set; }

        public virtual Role Role { get; set; }

        public virtual DateTime RegistrationDate { get; set; }
        public virtual DateTime LastLoginTime { get; set; }
        public virtual string LastIp { get; set; }
        public virtual bool IsActive { get; set; }

        public override bool Equals(object obj)
        {
               if (obj == null)
                   return false;

            var t = obj as UserInformation;

            if (t == null)
                return false;

            if (UserId == t.UserId)
                return true;
            
            return false;

        }

        public override int GetHashCode()
        {

            return UserId.GetHashCode();

        }


    }
}
